package com.sl.plugin.step.selenium.navigate;

import com.sl.core.engine.meta.ProcessCompDescriptorService;
import com.sl.core.engine.meta.impl.AbstractProcessCompDescriptor;
import com.sl.core.engine.meta.row.ProcessRowDescriptor;
import com.sl.plugin.step.selenium.navigate.config.SeleniumConfig;
import lombok.Getter;
import lombok.Setter;
import org.openqa.selenium.WebDriver;

import java.util.Map;

/**
 *
 */
@Getter
public class SeleniumNavigateCompCompDescriptor extends AbstractProcessCompDescriptor<
        SeleniumNavigateComp, SeleniumNavigateCompContext> implements ProcessCompDescriptorService {

    @Getter
    @Setter
    private SeleniumConfig seleniumConfig;

    //    @Override
//    protected ProcessCompService getComp() {
//        return new SeleniumNavigateComp(this);
//    }
//
//    @Override
//    public ProcessCompContextService getContext() {
//        return new SeleniumNavigateCompContext();
//    }
    public SeleniumNavigateCompCompDescriptor() {
    }

    public SeleniumNavigateCompCompDescriptor(Map<String, Object> attributeMaP) {
        attributeMap = attributeMaP;
    }

    @Override
    public void loadDescriptor(Map<String, Object> map) {
        //标记为起始
        this.setIsStartStep(true);
        excludeSerializableClass.add(WebDriver.class);
        map.put("seleniumConfig", new SeleniumConfig());
    }


    @Override
    public ProcessRowDescriptor getResultDescriptor(ProcessRowDescriptor rowDescriptor) {
        rowDescriptor.clear();
        rowDescriptor.addObj("webDriver");
        return rowDescriptor;
    }
}
